# # # t1 = (1, 2, 3)
# # # t2 = ('a', 'b', 'c')
# # # # 连接组合
# # # t3 = t1 + t2
# # # print(t3)
# # #
# # # t3 = (1, 2, 3, 4, 5, 6)
# # # del (t3)
# # # print(t3)
# #
# # n = input('请输入联系人姓名:')
# # t = input('请输入联系人电话:')
# # e = input('请输入联系人邮箱:')
# # a = input('请输入联系人地址:')
# # t1 = ('姓名:', n, '电话：', t,'邮箱:', e,'地址:',a)
# # print(t1)
# #
# # # 1.1 创建空列表
# # l1 = []
# # print(l1)
# #
# # # 1.2创建带有元素列表
# # l2 = [1, 2,'python', 'java']
# # print(l2)
# # print(type(l2))
# #
# #
# # # 2.1创建空列表
# # l3 = list()
# # print(l3)
# #
# #
# # # 2.2将字符串转化列表
# # l4 = list('hello world')
# # print(l4)
# #
# # # 2.3将元组转化成列表
# # t5 = tuple('hello')
# # print(t5)
# # l5 = list(t5)
# # print(l5)
# #
# #
# # # 2.4将range函数转化成列表
# # l6 = list(range(5))
# # print(l6)
# #
# # # 使用正索引访问p
# # l7 = [1, 2, 3, 4, 'p', 'w', 'r']
# # print(l7[4])
# # # 使用负索引访问w元素
# # print(l7[-2])
# #
# #
# # l8 = ['p', 'y', 't', 'h', 'o', 'n']
# # # # 使用正切片，截取索引2,3 4元素，步长1
# # print(l8[2:5])
# # #取前三个元素
# # print(l8[:3])
# # # 取后三个元素
# # print(l8[3:])
# # # # 使用正数切片
# # print(l8[1:2])
# # # # 使用负数切片
# # print(l8[-3:-1])
# # # # 步长是负数，从右向左提取
# # print(l8[::-1])
# #
# # l9 = [1, 2, 3, 4, 'pytyon', 'java', 'c']
# # for i in l9:
# #     print(i)
# #
# # # 修改单个元素
# # l10 = [10, 56, 34, 2, 56, 44, 7]
# #
# # #索引为2的元素值改为100
# # l10[2] = 100
# # print(l10)
# #
# # # # 修改多个元素
# # l11 = [10, 56, 34, 2, 56, 44, 7]
# #
# # # # #x修改第一到四个元素值(不包括第四个）
# # l11[1:4] = [45, -56, 98]
# # print(l11)
# #
# #
# # #1.append()用于在列表的
# # l12 = ['a', 'b', 'c']
# # l12.append('f')
# # print(l12)
# # # 列表添加列表
# # l12.append(['e', 'f'])
# # print(l12)
# #
# #
# # l13 = ['a', 'b', 'c']
# # l13.extend('d')
# # print(l13)
# # # 列表添加列表
# # l13.extend(['e', 'f', 'g', 'h'])
# # print(l13)
# # l13.extend('world')
# # print(l13)
# #
# #
# # l14 = ['python', 'c', 'java']
# # #插入元素，在索为2处插入go元素
# # l14.insert(2, 'go')
# # print(l14)
# #
# #
# # #remove()删除特定元素
# # l15 = ['a', 'b', 'c', 'd', 'a']
# # l15.remove('b')
# # print(l15)
# #
# #
# # #若元素不在列表中，删除会报错
# # l15.remove('f')
# #
# #
# # #pop删除指定索引处位置元素
# # l16 = [10, 2, 4, 6, 8, 'a']
# # l16.pop(3)
# # print(l16)
# #
# # #删除最后一个元素
# # l16.pop()
# # print(l16)
# #
# # #del 删除单个元素
# # l17 = ['a', 'b', 2, 3, 5, 9]
# # del l17[4]
# # print(l17)
# #
# # #del删除一段连续元素使用切片形式
# # del l17[1: 3]
# # print(l17)
# #
# # #清空列表clear()方法
# # l18 = [6, 8, 'a', 0]
# # l18.clear()
# # print(l18)
# # print('-------------------')
# #
# #
# name_list = []
# phone_list = []
# while 1:
#     print('菜单：1.添加联系人2.修改联系人3.删除联系人')
#     chione = input('请输入选择')
#     # 1.添加联系人，包括姓名，手机号
#     if chione =='1':
#         name_list.append(input('请输入联系人姓名'))
#         phone_list.append(input('请输入联系人电话'))
#         print(name_list)
#         print(phone_list)
#     # 2.修改联系人信息
#     elif chione == '2':
#         num = int(input('请输入联系人编号'))
#         if len(name_list) > 0 and num <= len(name_list):
#             name_list[num - 1] = input('修改联系人姓名')
#             phone_list[num - 1] = input('修改联系人电话')
#         else:
#             print('联系人编号输入有误')
#     # 3. 删除联系人信息
#     elif chione == '3':
#         num = int(input('请输入联系人编号'))
#         if len(name_list) > 0 and num <= len(name_list):
#             name_list.pop(num-1)
#             phone_list.pop(num - 1)
#         else:
#             print('联系人编号有误')
#     else:
#         print('显示联系人信息')
#         print(name_list)
#         print(phone_list)
#
#
#
# # 查找元素 index() 列表名，index【要查找的元素，索引起是位置，索引结束位置
ls1 = [1, 5, 7, 'a', 'a', 'c', 'b', 6, 4, 1]
print(ls1.index('a'))
print(ls1.index('a', 4))
print(ls1.index('a', 3, 7))

# # # count()方法用来统计某个元素在列表中出现的次数 列表名.count(统计的value元素
ls2 = [1, 3, 5, 7, 'a', 'b', 8, 3, 'b', 2, 5, 5, 7, 1]
print(ls2.count(8))
print(ls2.count(5))
print(ls2.count('f'))

# # 1,元素是字符串的排序
ls3 = ['1', '3', '44', '23', '88', '56', '233']
# 默认升序， reverse=false，不写
ls3.sort()
print(ls3)
# 降序 reverse=true
ls3.sort(reverse=True)
print(ls3)

# 2.元素是数值的排序
ls4 = [1, 3, 44, 23, 99, 88, 56, 233]
# # 默认升序
ls4.sort()
print(ls4)
# 降序 reverse=True
ls4.sort(reverse=True)
print(ls4)

##字典的创建
d1 = {'python': 90, "可视化": 89, "英语":85}
print(type(d1))

# #使用元组和数字作为key
d2 = {(23, 89):"great",30:[1, 3, 4]}
print(type(d2))
# 创建空字典
d3 = {}
print(type(d3))
#
#
#
#2. 用dict（）方法通过关键字的参数来创建字典格式
d4 = dict(数学=98, 语文=87, 英语=89)
print(d4)